Optimized energy management system

ABSTRACT

Methods and systems are provided for optimizing the control of energy supply and demand. An energy control unit includes one or more algorithms for scheduling the control of energy consumption devices on the basis of variables relating to forecast energy supply and demand. Devices for which energy consumption can be scheduled or deferred are activated during periods of cheapest energy usage. Battery storage and alternative energy sources (e.g., photovoltaic cells) are activated to sell energy to the power grid during periods that are determined to correspond to favorable cost conditions.

FIELD OF THE INVENTION

The invention relates generally to the field of energy management, andmore particularly, to various systems and methods for optimizing thecontrol of energy supply and demand in residences and businesses.

BACKGROUND OF THE INVENTION

As energy demand around the world has increased, pressure fromenvironmental concerns and energy price volatility has heightened theneed for energy conservation and alternative energy sources.Programmable thermostats have permitted consumers to program theirheating and cooling systems to reduce consumption during periods whenthey are not home or are asleep. Solar panels, fuel cells, windmills,back-up generators and other energy sources have become increasinglyavailable for use in residential homes and businesses. However, the useof such alternative sources and technologies has been limited because ofsuch factors as difficulty in recovering costs; unpredictability ofalternative energy supplies (e.g., sun, wind), and difficulty inintegrating such sources and devices into conventional electricalsystems.

Electric utilities have conventionally arranged to install specialdevices in homes and businesses that, when remotely activated by theutility, cut power to certain devices (e.g., air conditioners or hotwater heaters) during peak loading conditions. Customers who agree toinstall such devices are given discounts or other incentives forinstalling such devices, and in exchange the utility is able to bettermanage energy demand remotely. However, such arrangements are typicallyad-hoc and require that customers submit to the whims of the utilitycompany.

Some electric utilities charge varying rates based on demand. Forexample, during periods of peak demand, a higher rate for electricity ischarged. Conversely, during low-demand periods, a lower rate can becharged. Regulators in recent years have also forced utilities topurchase electricity back from consumers who are able to generate morethan they need. Such programs have met with limited success for variousreasons most particularly the inability of some types of energy users tocurtail energy use and the lack of real-time information regarding theimmediate cost of energy usage.

SUMMARY OF THE INVENTION

The invention includes various systems and methods for increasing theefficiency with which energy can be managed. In one variation, anintegrated control device manages the supply of energy from varioussources (e.g., electric grid, battery, photovoltaic cells, fuel cells)and the demand for energy from consumption devices (e.g., hot-waterheaters, HVAC systems, and appliances). An optimization algorithmdetermines based on various factors when to activate the energy sourcesand when to activate the consumption devices.

In one variation, the algorithm takes into account such factors as thesupply of charge on batteries, the dynamic price of electricity, weatherforecasts, and others in order to schedule and activate energy suppliesand consumption devices. Devices that can be scheduled for flexibleturn-on times (e.g., a washing machine or dishwasher) are scheduled forperiods in which cheap energy supply is projected to be available.

In another variation, when the algorithm determines that electricity canbe favorably sold to the electricity grid, alternative energy sourcesand storage devices are activated and electricity is sold to the grid.Customer preferences for maintaining control over the allocation ofpower can be taken into account in certain variations of the algorithm.

Other variations and embodiments are described in more detail below, andthe invention is not intended to be limited in any way by this briefsummary.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 shows a system employing various principles of the presentinvention.

FIG. 2 shows one possible arrangement for controller 104 of FIG. 1.

FIG. 3 shows a process and data/control flow for controlling energyproduction and usage in accordance with certain aspects of the presentinvention.

FIG. 4 shows a typical residential demand curve for electrical energyconsumption.

FIG. 5 shows a production curve for electricity from photovoltaic panelsoverlaid onto the demand curve of FIG. 4.

FIG. 6 shows how excess production may exceed the ability of thesystem's electronics to deliver power to the grid, meaning that ahardware constraint limits the rate of sale.

FIG. 7 shows the cost and availability of power from multiple sources.

FIG. 8 shows a least-cost determination method according to onevariation of the invention.

FIG. 9 shows in flow chart form one variation of an algorithm forleast-cost determination according to various principles of theinvention.

FIG. 10 shows how a deferrable load can be shifted from a high-costperiod (zone 3) to a lower-cost period (zone 7).

FIG. 11 shows a process for least-cost dispatch calculation.

FIG. 12 shows a process for determining whether a deferrable load can beserviced in a zone.

FIG. 13 shows a process for estimating a daily profile.

FIG. 14 shows the piecewise constant approximation of a monotonic costof production curve.

FIG. 15 shows the piecewise constant approximation of a non-monotoniccost of production curve.

DETAILED DESCRIPTION OF THE INVENTION

FIG. 1 shows a system employing various principles of the presentinvention. As shown in FIG. 1, apparatus 101 includes a unit 103comprising a controller 104 and an internal storage device 105. Internalstorage device 105 may comprise, for example, a plurality of lead-acidor nickel-metal-hydride storage batteries for storing electrical energy,and/or large capacitors. External storage device 106 may be optionallyincluded to store additional electrical energy. As explained in moredetail herein, storage devices 105 and 106 may provide power to variousdevices during times of electrical grid outages or during periods whereelectrical grid costs exceed certain thresholds, and they may be used tosell power back to the electrical utility during times that aredetermined to be favorable. The storage capacities of devices 105 and106 may be selected to suit a particular environment, such as the needsof a typical home residence, business, or other electrical consumer. Thesmallest storage capacity anticipated is 840 amp-hours (AH) at 12V,while currently planned units have capacities ranging to 1600 AH at 48V.Larger storage capacity may be obtained in the future using flywheels orvery large capacitors.

Storage in the form of compressed air is usually discounted due to thepoor thermodynamic efficiency, but the capital cost is low and in somecases the marginal value of solar power is zero (when supply exceedsdemand the excess cannot be sold or stored by other means), socompressed air storage may be practical in some embodiments of theinvention. Finally, in some specific locations it may be possible tostore power by pumping water to an elevated water tower or reservoir(pumped storage) which could increase storage capacity by another factorof 10. Power electronics, including inverters for converting DCelectrical energy into AC energy, circuit breakers, phase converters andthe like, may also be included but are not separately shown in FIG. 1.

Controller 104 may comprise a computer and memory programmed withcomputer software for controlling the operation of apparatus 101 inorder to receive electrical power from power sources 109 through 115 andto distribute electrical power to devices 116 through 122. Furtherdetails of various steps that may be carried out by such software aredescribed in more detail herein.

Controller 104 and internal storage device 105 may be housed in a unit103 such as a metal rack having appropriate cabling and supportstructures. One possible design for unit 103 is shown in a pending U.S.patent application Ser. No. 11,037,832 by Danley et al. filed on Jan.18, 2005, entitled “Fully Integrated Power Storage and Supply Appliancewith Power Uploading Capability” (published as U.S. Pat. Appl. Pub. No.20060158037).

Apparatus 101 also includes a user interface 102 for controlling theoperation of unit 103. The user interface may comprise a keypad and CRT,LED or LCD display panel or vacuum fluorescent type; a computer displayand keyboard; or any other similar interface. The user interface may beused to select various modes of operation; to display informationregarding the operation of the apparatus; and for programming theapparatus.

An optional control center 108 may be provided to transmit commands toapparatus 101 through a network, such as WAN 107 (e.g., the Internet).Control center 108 may be located at a remote location, such as acentral control facility, that transmits commands to a plurality ofunits 101 located in different homes or businesses. In addition totransmitting commands, control center 108 may transmit pricinginformation (e.g., current price of electricity) so that controller 104may make decisions regarding the control and distribution of electricityaccording to various principles of the invention.

Apparatus 101 is coupled to the electric utility grid 115 through apower interface (not shown), which may include circuit breakers, surgesuppressors and other electrical devices. Electricity may be supplied invarious forms, such as 110 volts or 240 volts commonly found in homes. Abackup generator 114 may also be provided and be controlled by apparatus101 when needed. One or more alternative energy sources 109 through 113may also be provided in order to provide electrical power to theapparatus. Such sources may include photovoltaic (PV) cells 109, whichmay be mounted on a roof of the home or business; micro-hydroelectricpower generators 110, which generate power based on the movement ofwater; gas turbines 111; windmills or other wind-based devices 112; andfuel cells 113. Other sources may of course be provided.

During normal operation, power from one or more of the power sources canbe used to charge storage units 105 and 106 and/or to meet demand inaddition to electric grid 115. During power outages or brownouts fromgrid 115, these additional power sources (as well as storage units 105and 106) can be used to meet energy demand. Additionally, surplus powercan be sold back to the power grid based on optimization of supply anddemand calculations as explained in more detail herein.

The bold lines shown in FIG. 1 indicate electrical distribution paths.Control paths to and from the various devices are not separately shownbut are implied in FIG. 1.

One or more power-consuming devices 116 through 122 may also becontrolled by and receive power from apparatus 101. These include one ormore sensors 116 (e.g., thermostats, occupancy sensors, humidity gaugesand the like); heating/ventilation/air-conditioning units 117; hot waterheaters 118; window shades 119; windows 120 (e.g., open/close and/ortint controls); and one or more appliances 121 (e.g., washing machines;dryers; dishwashers; refrigerators; etc.). Some appliances may beso-called “smart” appliances that can receive control signals directlyfrom apparatus 101. Other conventional appliances can be controlledusing one or more controllable relays 122. It is not necessary in allembodiments that apparatus 101 directly provide electricity to devices116 through 112. For example, apparatus 101 could be tied into theelectrical power system in a home or business and electricity would besupplied through that path to the devices. Appropriate cut-off devicesand bypass switches would then be used, for example, in the event of apower outage to disconnect the home wiring system from the electricalgrid and to connect apparatus 101 to the wiring network. Such schemesare conventional and no further details are necessary to understandtheir operation.

FIG. 2 shows further details of controller 104 according to onevariation of the invention. A watchdog timer 209 continuously monitorsthe operation of apparatus 101 in order to detect possible malfunctions.In one variation, watchdog timer 209 periodically polls devices in thesystem to ensure that they are functioning, and that no error signalshave been detected. Watchdog timer 209 may be coupled to a modem 210 toreport failures or other events to control center 108. A USB port 211and pager interface 212 may also be provided to receive inputs from orreport data to various devices. For example, the report of a malfunctioncan be transmitted to a pager worn by the owner of the premises in whichthe apparatus is located.

Various software functions shown in FIG. 2 include an administrativefunction 201, which may include such things as interfacing with watchdogtimer 209; operating the user interface 102; controlling the modes ofthe apparatus; and other administrative operations. A safety function202 monitors voltage levels, temperatures, and other variables in orderto ensure that the apparatus is operating safely and to shut down thedevice if an unsafe condition is detected. An optimization function 203,details of which are provided below, makes decisions concerning whetherand when to activate various power sources and power-consuming devices.A communication function 204 interfaces to a web server 207 in order toprovide external communications facilities. A logging function 205maintains records regarding the operation of the device and stores themin a nonvolatile device such as compact flash storage device 206. Aninput/output board 208 provides communication and control signals tovarious devices in the system, which may include pollable devices 213;voltage sources 214; pulse-based devices 215; message-based devices 216;and other types of devices 217. Various device drivers may also beprovided but are not separately shown in FIG. 2. Rather than controllingdevices directly, the apparatus can be configured to operate with athird-part home-automation control system in order to control thedevices.

According to various principles of the invention, energy usage can beoptimized to deliver power in the most efficient way, where efficiencyis defined in terms of the amount of energy used, cost, or a balance ofthe two. In conventional energy management systems, emphasis has been onconservation—e.g., turning out lights when a room is not occupied, orturning down the thermostat at night. By integrating supply side optionswith energy consumption choices, various algorithms can be used toincrease the energy and cost savings.

For example, a small business may pay for electricity on a per-kilowatthour basis with an additional charge for a peak number of kilowatt-hoursduring a billing period. The so-called “demand rate” is designed todiscourage peaky consumption because of the high cost of providing highamounts of power for a short period. According to various principles ofthe invention, the instantaneous energy usage can be monitored and, ifdemand exceeds a threshold, power from batteries can be used to reducedemand from the grid, or non-critical energy uses such as a largecommercial freezer that can easily be unplugged for an extended timeperiod with little or no impact can be temporarily shut off. This ismade capable by several features of the invention. For example, thesensors (116) allow monitoring of individual loads. The direct controls(117, 118, 119, 120) allow for the interruption of certain appliances,while the controllable relays (122) allow for control of applianceswithout built-in control logic. Whether and to what extent an appliancecan be interrupted is defined in the energy source configuration element(313), described with reference to FIG. 3 below. The method foraddressing deferrable load which is described subsequently allows anelectrical service (cooling in this example) to be optimally rescheduledfor a later time to reduce cost.

As another example, suppose that residents of a house are cooking,showering, watching TV, and starting laundry. They pay time-of-use ratesthat are at a peak in the morning and evening, so power from the grid is14 cents per KWh. Given the high price, according to various inventiveprinciples, the system can control the laundry devices so that they arenot activated until later in the day, when energy costs are cheaper. Inone variation, the system can determine based on the date (e.g., June21) and the weather forecast (e.g., sunny) that likely production fromsolar panels will be high, and decide to sell power from the batteriesto the grid (when the rate is high) with the expectation that thebatteries can be recharged later in the day when the family is not homeand energy usage is minimal. The batteries could alternatively berecharged later in the day from the power grid, when electrical costsare lower.

Certain variations of the invention consider weather when forecastingdemand for electrical power and the supply from energy sources whoseproduction capacity is weather dependent, such as PV panels.

As yet another example, suppose that a power outage occurs, removingpower from a home. Conventional back-up systems would immediatelyprovide battery back-up or engage a back-up generator in order to supplypower to pre-selected “critical” devices, such as freezers,refrigerators, selected lights, etc. According to certain principles ofthe invention, a controller programmed to optimize energy supply andusage would defer turning on the freezer or refrigerator during thefirst hour or two of the black-out, because of its knowledge that suchdevices can be disconnected from the power grid for an hour or two withlittle or no consequence, thus preserving energy. However, if the outagepersists, backup power could be selectively applied to those devices,while inhibiting others. Other examples and principles are explained inmore detail below.

There are at least two methods for managing loads during an emergency.The simpler method, which is currently the common approach for premiseswith backup energy systems, is to wire the facility with two (or more)circuits, one designated “secure” and the other “unsecure.” When gridpower is interrupted, services are maintained for the secure circuitonly. The weakness of this approach is that the priorities for use ofthe limited backup supply change over the duration of an outage.Refrigeration is not immediately critical, but very important later.Upstairs lights may not be important during the day but very importantat night.

Certain embodiments of the invention allow for control of individualappliances due to the connections to sensors (116), controllableappliances (117, 118, 119, and 120) and controllable relays (122).Appliance performance characteristics and criticality are expressed inthe energy source configuration elements (313, discussed below). Thesystem knows the amount of current storage and supply from alternativesources and can provide an accurate forecast of demand and alternativesupply by methods described subsequently. Together these can provide theuser with information to manage energy effectively in real time or todevelop algorithms to be executed in the absence of direct control.

FIG. 3 shows a process and data/control flow for controlling energyproduction and usage in accordance with certain aspects of the presentinvention. A clock 301 acts as a control loop for the process. In step302, energy usage is monitored by circuit or services, and in step 303,energy production is monitored by source. In step 312, externalinformation regarding such variables as current grid prices; fuelprices; grid voltage; current/forecasted weather; demand-side management(DSM) requests (e.g., a request from a utility under an establisheddemand response program for subscribing customers to reduce demand orsupply power from a user controlled source at a specific hour), andcommands received from central control center 108 are monitored. Thecurrent energy source configuration is determined (step 313), includingsuch things as what power sources are available and how much energy isstored in storage devices. End use of technology configuration isobtained (step 314), including the inventory of technologies thatconsume energy in the home or business ranging from small sources suchas lights to major HVAC equipment. The inventory may include the numberof such appliances, the circuit on which they are located, how and towhat extent they can be controlled, typical day-of-use patterns, andwhether there is flexibility in scheduling the use of the appliance. Forexample, it may be possible to delay the hour at which the dishwasher isactivated from the time it is loaded until a later hour, if the costwould be lower at that time. Block 314 can be provided through a userinterface during a configuration step. Information from these blocks isinput to a baseline demand forecast step 304 and a baseline productioncapacity forecast 305.

The demand forecast step 304 can be performed in many different ways. Inone embodiment, energy demand is forecast based on historical data(e.g., energy demand based on the time of day and time of year for theparticular facility in which the device is located). In anotherembodiment, energy demand can take into account ambient conditions suchas temperature and sunshine. In yet another embodiment, one of severalpreprogrammed energy demand models can be selected by a user of thesystem. In one or more of these embodiments, energy demand can beforecasted at particular points in time (e.g., in five-minuteincrements) for a forecast period (e.g., 24 hours).

The baseline production capacity forecast step 305 can also be carriedout in various ways. If solar cells are available, a production forecastcan be based on a weather forecast (e.g., sunny, partly sunny, partlycloudy, cloudy, showers, etc.) in combination with time-of-year, incombination with historical data. If a fuel cell is available, dataconcerning production availability for the fuel cell can be obtained,and so forth. For sources which are not weather dependent, theproduction capacity (and efficiency as measured in terms of $/kWh) canbe initially estimated from engineering data. The engineering estimatedcan be subsequently replaced with actual operating data which reflectsthe characteristics of the specific unit rather the general model.

For solar, the production capacity can be estimated as a function ofsolar insolation using the design efficiency data characteristic of thepanel. Of course, this too may vary with the actual location and factorssuch as the amount of dust which has built up on the units since thelast rain. These factors can be accounted for by two methods. Facilityspecific factors (facing, degree of shading) are incorporated throughthe collection of actual performance data over different seasons.Short-term factors are incorporated by the method of re-estimating themodel parameters every 15 minutes, rather than simply executing the samemodel. The best predictor of production in the next 15 minutes isgenerally the previous 15 minutes.

The baseline demand forecast 304 and baseline production capacityforecast 305 provide a detailed picture of the potential supply of powerby source and demand by use of energy. Essentially these frame anoptimization problem which can be solved. Embodiments of the inventioncan determine how to modify demand by turning off unneeded servicesand/or delaying others, how to deploy various sources to meet demand,and how to distribute power to the grid to achieve the lowest possiblecost of service (which may be negative if the home or business is ableto produce more power than it consumes in a time period).

Given the input demand and supply projections, this optimization can bedone in two basic steps—the calculations and the implementation. Thecalculation of the optimal strategy can be done in three parts. First, aleast-cost dispatch model step 308 (details of which are provided below)determines the lowest cost way of meeting the unmodified demand usingthe available sources. This calculation provides an estimate of theexpected value of power during the forecast period. This estimate isthen used to determine which uses of energy should be deferred and untilwhen. The deferrable service schedule is element 309 in FIG. 3. Detailsof 309 are provided below. The final step in the calculation is todetermine when energy should be bought and sold (arbitraged), details ofwhich are provided below.

Once the use of end-use technologies, sources, and storage have beendetermined in 308, 309, and 310, commands are issued to the devices toeffect their operation in 318. Some of the devices can be under thedirect control of the invention (e.g. the batteries) but others can becontrolled by means of a communications interface. The means ofcommunicating with appliances is specified in the configurationspecification 317, in which the installer of the system specifies thephysical means of communicating to the device, the communicationsprotocols, the addressing protocols, and the structure and content ofthe messages. The means of communications can include wireless means(e.g. IEEE 802.11 networks of various generations, or IEEE 802.15.4networks), radio frequency transmission over the power line (such aswith X10), or Ethernet. The communications protocols can includeInternet Protocols or methods designed for low cost, low bandwidthcontrol such as LonWorks. The addressing protocols can include anymethod for distinguishing between multiple appliances connected to thesame network. IP addresses are an example as is the naming scheme usedby X10 (house code:unit code), but many home automation controllersimplement proprietary schemes. The message structure is specific to theappliance design.

The following describes in more detail how the system can determinewhich of multiple, alternative sources of power to draw on to meetdemand. These are methods of element 308 of FIG. 3. The explanationnecessarily begins with a discussion of supply and demand management inthe context of a grid connected system with one or more alternativeenergy sources.

Energy demand at a premise varies over the time of day. In a typicalhome there is a peak in the morning when the family gets up, turns onlights, radios and televisions, cooks breakfast, and heats hot water tomake up for the amount used in showers. When the family leaves for workand school it may leave the clothes washer and dishwasher running, butwhen these are done, demand drops to a lower level but not to zero asthe air conditioners, refrigerators, hot waters and the like continue tooperate. Usage goes up as the family returns, peaking around dinner whenthe entire family is home. This creates the typical “double hump” demandcurve as shown in FIG. 4.

Businesses tend to follow different patterns depending on the nature ofthe business. Usage is low when the office is closed, and relativelyconstant when the office is open. In extreme climates where airconditioning cannot be cut back overnight, energy use over the course ofthe day is more constant. Businesses like restaurants may start later inmorning and their peak extends farther into the evening. A factory withan energy intensive process operating three shifts may show little orvariation over the course of the day.

As alternative energy sources become available, management ofelectricity involves more than simply buying power from the grid. Thequestion becomes when and to what extent power can be derived from thealternative sources, and when it is economically optimal to do so.

Each alternative source of energy has its own profile of capacity overthe course of the day as well as fixed and marginal costs. FIG. 5 showsa production curve for electricity from photovoltaic panels (502)overlaid onto the demand curve (501). Since PV panels have zero marginalcost, they are the preferred source of power whenever available. PVpanels, however, produce power only when the sun shines. On a clear day,power production is at its peak around the middle of the day (subject,of course to the orientation of the panels and possible obstructionssuch as large buildings or trees). When demand exceeds the poweravailable from the PV panels, the difference must be made up with powerpurchased from the grid, as at 503 in FIG. 5. When solar power exceedsthe demand, as at 504, the excess can be sold to the grid. The distancebetween the supply curve and the demand curve represents the amount ofpower available for sale at any instance (in kW). The integral of thispower over a time interval is the energy sold (kWh).

In some cases the excess production (shown as the distance between thesupply and demand curves at any time) may exceed the ability of thesystem's electronics to deliver power to the grid. That is, there may bea hardware constraint that limits the rate of sale (measured in kW).This is shown by line 601 in FIG. 6 as an increment over the demandcurve.

The example just presented assumes that there are two sources ofelectrical supply to the premise. These are the grid and the PV panels.Preference is generally given to the solar panels as a source when theyare available because the marginal cost is zero while the marginal costof the grid is the prevailing rate. There may, however, be one or morealternative sources with non-zero marginal cost. These may be used(deployed) when their marginal cost is lower than the otheralternatives.

This is shown in FIG. 7. The irregular curve in the bottom graph plotsthe price of electricity (in cents/kWh) over the course of a day. Thearea 704 represents the price of electricity from the grid. As is commonin many areas, this varies over the course of the day. The time of dayrates is designed to reflect the marginally higher cost of powerproduction at the peak demand periods of morning and early evening. Atthese times utilities must dispatch power from their least efficientunits, while, when cost is lower, they need power only from the mostefficient units. In this rate diagram, there is a broad morning peak,and a peak and “shoulder” rate 706 in the early evening.

The line 705 shows the marginal cost of producing power from analternative source A. This may be a fuel cell, a small scalehydroelectric turbine, a natural gas turbine, a wind generator, or agasoline or diesel backup generator. In this example, this is a constantover the course of the day, but this is not necessarily the case.Marginal cost is shown here rather than total cost (which includesamortization of the capital cost and operating and maintenance costs notrelated to actual use) as the immediate decision on the relative meritof a potential source at any instant is related only to the marginalcost. The marginal cost of solar power is essentially zero. This isshown by line 707.

The upper graph shows the capacity of the solar panels 702 (which is afunction of solar insolation, and hence, time of day) and the capacityof the Alternative Source A 703, which is shown as flat, but need notbe. The capacity of the grid is not shown as is it presumed to exceeddemand and is, therefore, irrelevant. Line 701 represents the totalproduction capacity of the PV panels and Alternative Source A. Theproduction capacity curves can be initially derived from engineeringdata provided by the supplier of the technology. These curves can thenbe updated based on data collected during actual use. The sensor, datalogging, and computational capabilities of embodiments of the inventionmake it possible to re-estimate a linear production model every 15minutes in one embodiment.

At any point in time, there is a particular order of preference inderiving power from the different sources. This is in increasing orderof marginal cost beginning with the least expensive.

FIG. 8 shows a day divided into 13 zones, labeled Z1 through Z13 frommorning until evening. These zones delineate different modes ofoperation, stemming either from a change in the relative prices of thedifferent sources of energy or changes in demand relative to thecapacity of the different sources. The modes of operation in thisexample are as follows:

Z1: There is no solar production and the marginal price of thealternative source is greater than the price from the grid. Demand ismet entirely with purchases from the grid.

Z2: The price from the grid increases with the morning peak period andnow exceeds the marginal cost of the alternative source. Production fromthe alternative source is immediately taken to its maximum, but this isnot sufficient to supply the full demand. The difference is bought fromthe grid.

Z3: Solar production begins to ramp up. Production from the solar panelsand the alternative source is not sufficient to meet demand. Solar andthe alternative source are used at full capacity. The balance ispurchased from the grid.

Z4: Demand is met fully from the solar panels and the alternativesource. There are no longer purchases from the grid. Sales to the gridbegin.

Z5: The price from the grid drops so that it is no longer economical touse the alternative power source. Production from the solar panels isnot sufficient to meet demand, so there are some minor purchases fromthe grid.

Z6: Solar production now exceeds demands. The entire excess can be soldto the grid as the total excess is less than the capacity of the unit toreturn power to the grid.

Z7: All production is from solar. Sales to the grid are at the maximumcapacity of the unit.

Z8: All production is from solar, and there is excess capacity to sellto the grid, but the excess is less than the maximum capacity of theunit.

Z9: Solar demand is not longer sufficient to meet demand. Full demandcould be met without purchases from the grid as both solar and thealternative sources are deployed. However, the marginal cost of thealternative source is greater than the price of electricity from thegrid, so the difference between demand and solar production is made upthrough purchases from the grid. There are no sales to the grid eventhough there is sufficient onsite capacity, as it is not cost effective.

Z10: It is not possible to meet demand solely from the solar panels andthe alternative power unit. Purchases from the grid are necessary. Salesare not possible. Solar power is used to the maximum possible extent,but the alternative power source is not used as it is not costeffective.

Z11: The price of power from the grid increases to the point where it iscost effective to deploy the alternative power source. As demand exceedssolar production plus the maximum capacity of the alternative source,the alternative source is run at full capacity. The balance is purchasedfrom the grid.

Z12: Solar production drops to zero. The alternative power source is runat capacity. The balance of demand is met with purchases from the grid.

Z13: The price of power from the grid is lower than the marginal cost ofproduction from alternative source A. All power is purchased from thegrid.

The following table summarizes the above modes and decision-makingpoints:

Grid Production from Production from Zone Purchases Solar PanelsAlternative Source Z1 Yes Z2 Yes Yes Z3 Yes Yes Yes Z4 Yes Yes Z5 YesYes Z6 Yes Z7 Yes Z8 Yes Z9 Yes Yes Z10 Yes Yes Z11 Yes Yes Yes Z12 YesYes Z13 Yes

At any point in time, according to one variation of the invention, thecontroller performs an instantaneous calculation of comparative cost andselects the optimal order of dispatch. Essentially, the objective of thealgorithm is to define the production from each source. One variation ofthis algorithm is described in the following pseudo code:

j,k,m = arbitrary counters t = current time (arbitrary serial timemeasure) ns = number of sources of power (unitless) MCs(t) = marginalcost of source s at time t (cents per kWh) CAPs(t) = capacity of sources at time t (kW) Let s = 0 represent the grid MCo(t) = rate per kWhprevailing at time t (cents per kWh) CAPo(t)>>demand at time t (kW) Lets = 1 represent solar MC1(t) = 0 (i.e. the marginal cost of the solarsystem is zero (cents per kWh) D(t) = aggregate demand at time t (kW)SELLCAP = maximum rate at which power can be sold to the grid (kW) UNSAT= demand not satisfied by currently committed capacity (kW) ORDER =vector of index number (s) of sources in ascending order of cost at timet PRODk = optimal production from source k (kW) // initializeunsatisfied demand to total demand UNSAT = D(t) // initialize productionfrom all sources to zero FOR k = 1 TO ns PROD(k) = 0 NEXT k // sortsources in ascending order of prices (using a simple sort algorithm)ORDER(1) = SOURCE NUMBER (s) OF LOWEST COST ORDER(2) = SOURCE NUMBER OFSECOND LOWEST COST Etc. // allocate production from lowest cost tohighest until demand is met // loop through sources in ascending orderwhile the amount of allocated power is not // sufficient to meet demand(i.e. UNSAT > 0) j = 0 DO WHILE UNSAT > 0 j = j + 1 k = ORDER(j) //    determine if this is the marginal source //     (i.e. the mostexpensive one necessary to meet demand) IF (UNSAT>CAPk(t)) THEN //    not the marginal producer PROD(k) = CAPk(t)) UNSAT = UNSAT −PRODUCTION(k) ELSE //     this is the marginal producer //     determineif it is cost effective to sell or not by comparing to the cost of thegrid IF MCk(t) < MCo(t) THEN //         You can sell from this unit.There are two cases: IF CAPk(t) > UNSAT + SELLCAP THEN //            Case 1: the maximum capacity of the marginal unit (k) is //sufficient to meet demand and sell the power at the maximum capacity ofthe unit PROD(k) = UNSAT + SELLCAP UNSAT = 0 SELLCAP = 0 ELSE //        Case 2: you can sell the full capacity of this unit. PROD(k) =CAPk(t) SELLCAP = SELLCAP − (CAPk(t) − UNSAT) UNSAT = 0 //           Determine if there is an unallocated source that is notneeded //            to meet demand, but which can sell powereffectively IF j < ns THEN FOR m = j + 1 to ns k = ORDER(m) IF MCk(t) <MCo(t) Then //marginal cost of this source is less than the grid price,so // power can be sold PROD(k) = MAXIMUM(CAPk(t),SELLCAP) SELLCAP =SELLCAP − PROD(k) END IF END FOR END IF END WHILE

FIG. 9 shows this process graphically in flow chart form.

The case discussed to this point pertains where the marginal cost ofproduction from a source is not a function of the capacity drawn fromthat source. This is the case, for example, with the grid (in theabsence of demand charges) and photovoltaic panels (where the marginalcost is approximately zero) and so will pertain in many situations.

In some cases, however, the controller may be used to control sourceswhere the cost does vary with capacity. In diesel generators, forexample efficiency (and, hence, cost per kWh) varies with speed ofoperation. This is generally true of mechanical devices. This sectiondescribes a family of approaches to the determination of the least costdispatch in the cases where cost per kWh is a function of kWh from asource. This general solution will work in the case where price isconstant, but the calculation may be substantially more difficult andtime consuming. Given the limited computational power that may exist inthe controller and the need to keep that capacity available for safetymonitoring, communications, and other functions, it may be useful toimplement both the general and simpler (special case) algorithm and touse the simpler one when appropriate.

The general problem to be solved in least cost dispatch is to minimizethe cost of production necessary to meet demand. In the case wheremarginal cost is a function of production from a unit, this objective isstated as follows:

${Minimize}{\sum\limits_{i = 1}^{n\; s}{\left( {\int_{o}^{{prod}_{i}{(t)}}{{{MC}_{i}\left( {x,t} \right)}\ {\mathbb{d}x}}} \right)\mspace{14mu}{where}}}$x = amount  of  power  drawn  from  source${{Such}\mspace{14mu}{that}\text{:}{\sum\limits_{i = 1}^{ns}\;{{prod}_{i}(t)}}} = {{D(t)}.}$

This is the same problem as stated for the basic case, except thatmarginal cost (MC) is now a function of production from the technology.

Within the general problem of dispatch with production-variant marginalcost, there is one special case which can also be solved by a simplemeans. This is the case where cost is non-decreasing over any intervalfrom zero to the capacity of the unit for each dispatchable unit.

FIG. 14 shows a common exponential production cost curve (1401). Thiscurve can be approximated by a series of ranges within each of whichcost is assumed to be constant. (1402). These ranges can be defined byseveral means. The simplest is to define the regions with a fixedwidth—spanning, say, 100-watt intervals (0-100 watts, 100-200 watts,etc.). An alternative is to create irregular intervals to reflect thatthere is greater change in some areas of the curve than others. Narrowerzones are used where the production curve is steepest. This latterapproach may be preferred in that it yields greater accuracy in costestimation for the same number of ranges. Equivalent or better accuracycan, of course, be achieved by using more (narrower) ranges, but at apenalty in the speed of calculation.

For use in the least cost dispatch calculation, the correct constantvalue to use for an interval is the one which gives the same total costas the accurate curve. This is given by:

AVGCOSTi = (1/(PMax_(i) − PMax_(i − 1)))∫_(PMax_(i − 1))^(PMax_(i))MCi(x, t) 𝕕x

Where:

AVGCOST_(i)=the average marginal cost to be used for interval i

PMax_(i)=the upper bound of the interval

PMax_(o)=0

MCi(x,t)=marginal cost of source

Note that this average cost pertains only at time t, since the leastcost dispatch problem is solved for a specific time. Different solutionspertain at different times. The subscript t is not included in thisnotation as it is implicit.

In the special case (as illustrated in FIG. 14) where cost isincreasing, the least cost dispatch solution can be obtained usingprecisely the same algorithm as for the constant price case previouslypresented by treating each range as a virtual alternative source. Theincreasing price ensures that the ranges will be dispatched in order. Inthe event that the curve is not continually increasing, but simplynon-decreasing (i.e. there is a range over which the marginal cost isconstant), it is logical to include this entirely within a range, toavoid the risk that there would be two ranges (or virtual sources) withthe same prices that might be dispatched in the incorrect order.

The most general case involves a non-monotonic marginal cost curve—thatis, a curve in which the first derivative of the curve is neither alwaysnon-increasing or always non-decreasing. This is illustrated in FIG. 15,which shows the actual production curve (1501) and a piecewise constantapproximation (1502). In this figure the zones are numbered to supportthe discussion which follows. In this case, the algorithm specified forthe fixed-cost case would choose to dispatch zone 4 first, followed by3, 5, 13, 6, 2, etc. in that order. Clearly this is not possible from aphysical perspective. One cannot commit the power from a zone (i.e.dispatch the zone) until the prior zone has been committed. Simply, thistechnology is most efficient when producing at the level comprising zone4. One does not have the option of producing a very small amount (i.e.zone 1 or zone 2) at the cost of zone 4. To solve the problem onevariation of the model which follows treats each zone as a logicalseparate source, which can only be dispatched in ascending order.

Though the fixed-cost case cannot be used, the problem can be formulatedinto a binary integer program of modest scale. The starting assumptionis that the production (marginal cost) curve can be decomposed into anumber of zones. This is done for both the constant cost sources (e.g.the grid and solar at a point in time t) as for the sources for whichthe marginal cost is not constant with level of production, whetherthese are monotonic or not.

The second of the three stages of the optimization (following theleast-cost dispatch) is to manage the electrical loads in the home orbusiness. The concept of using computers or microprocessors to manageelectrical loads is not new, but the invention offers innovation inseveral areas, described below.

Conventional load management is done in two ways—at the point of use andby means of a central controller. Point-of-use technologies mostcommonly address lights and HVAC equipment. Lighting controls couple thelights to occupancy sensors which turn on the light when the room isoccupied and off after a user specified time period when the room is notoccupied. In some installations a switch is installed in series betweenthe sensor and the lamp so that the light turns on only when occupancyis detected and the switch is in the on position. This prevents thelight from being used when the occupant feels that there is sufficientlight from other sources. This is simple, reliable, and commonlydeployed technology. Use of the invention does not preclude this sort ofcontrolled light.

HVAC equipment is controlled by a thermostat. A thermostat consists ofthree components—a temperature sensor, a mechanism for turning theconnected HVAC component on when temperature is out of range, and a userinterface of some kind. In simple, older thermostats, the temperaturewas a bimetallic strip that curved increasingly as the temperature rose.This bimetallic switch composed on contact of a simple contact switchthat comprised the on/off control mechanism. The user interface was asimple rotating knob that moved the location of the bimetallic strip sothat a greater or lesser curve was necessary to close the contact. Thisgeneration of technology was simple to use and cheap and effective inregulating temperature, but required manual intervention to adjust theset-point to reflect different user preferences for factors such as timeof day or vacation.

Common thermostats of more recent design incorporate a processor so thatusers can program the preferred temperature by time of day and day ofweek. These offer improved performance but have several basic flaws: (1)the classification of daily patterns into weekend and weekday is toosimplistic; (2) the system does not automatically compensate fordeviations from the patterns, such as on holidays, vacations, or dayswhen a person must stay home from work; (3) in installations where thereare multiple zones with individual thermostats, there is unnecessaryduplication of the processor, since a single processor could easilymanage multiple zones; (4) when there are multiple thermostats they areunconnected to the others and operates independently, the user interfaceon the thermostat is very poor in comparison to the web-basedapplication interfaces; (5) thermostats cannot be controlled remotely.

A more advanced generation of control systems has emerged to addressthese problems and to provide more advanced control. These are homeautomation controllers (HACs) such as those offered by Smarthome™ andControl4™. HACs are typically multi-function devices, providingfunctionality in one or more of four areas: entertainment, premisessecurity, communications and networking, and environmental control whichincludes lighting and HVAC. This generation of controller provides asuperior user interface typically using a CRT or LCD monitor (sometimescompact) and keyboard or custom keypad, and a single controller whichcan manage multiple zones and end-use functions. The more powerfulprocessor and better interface allows for more complex configuration ofusage patterns.

To date, however, environmental control has been the least developed ofthe HAC control functions. HAC development has focused first onmanagement of entertainment systems including whole-home audio and videoand home theatre. Variants of the invention, by means of integratedsupply side and storage technology and advanced algorithms, providesuperior energy management.

Least-cost dispatching is the first step in advanced control. The secondstep is management of deferrable loads. The total demand is made up ofmultiple small components. Some of these can be deferred or accelerated.That is, the service they supply can be rescheduled to reduce energycosts. In some cases this simply changes the time at which the energy isused. In other cases it can reduce the total amount of energy used. Someexamples include:

Dishwashing: Dishes can be loaded for washing at a future time, up tothe time when the dishes are needed less the cycle time. Energy use isroughly the same whether dishes are washed immediately or later.

Clothes washing: Clothes washers and dryers, like dishwashers, aresimilarly deferrable. In the case of dryers it is sometimes advantageousfrom a quality of service perspective to delay the start so that thecycle finishes when someone is there to empty the dryer.

Hot Water Heaters: Hot water heaters are typically designed to maintainwater at a constant high temperature. Energy is lost from the system intwo basic ways—through the use of hot water and standing losses, whichare losses that occur when water is not being used. Standing lossesoccur though the shell of the hot water heater itself and from the hotwater in the pipes throughout the premise. Since the ramp up in energyprices in the 1970s the insulation of the hot water heaters has beenimproved substantially, until the losses are much smaller than waspreviously the norm.

Hot water pipes, however, are not typically insulated. In a modelhousehold, the demand for hot water drops off when everyone is done withtheir morning showers, except for some latent dishwashing or clotheswashing. Thus, demand is essentially zero during the day. Shutting offhot water heating when there is no demand is useful for reducinginstantaneous demand, but can also reduce total energy consumption. Theenergy savings are due to the nonlinear nature of heat loss. Roughly,the rate of heat loss from a warm body is a function of the third powerof the temperature—the standing losses are higher when the temperatureis higher. Allowing the water to cool reduces the rate of heat loss.Hence, less energy is used to heat water later when it is needed than toheat it immediately and then keep it warm for hours. The method foroptimally scheduling loads that need not be executed at a specific timeis described below.

Refrigerators: Refrigerators are not typically useful from theperspective of energy demand management. A more or less constant lowtemperature is essential for preserving food safely and maintaining itsquality. As in the dishwasher, there are losses when the refrigerator isused (i.e. the door is opened) as well as standing losses even when therefrigerator is not being used. In the case of refrigerators, it isimperative that the temperature be returned to the set point as quicklyas possible when heat is allowed to enter the cabinet. Thus, it is notpossible to save energy by deferring the cooling. A refrigerator's totalenergy will be essentially the same regardless of the energy managementsystem.

That said, however, the high quality insulation of a modern refrigeratormakes it possible to defer load for modest periods (on the order of 15minutes) while in temperature maintenance mode without adverselyaffecting the interior temperature. This is useful for load managementif not for energy management.

FIG. 10 shows the energy and load impact of deferring energy use fromthese controllable loads. FIG. 10 shows an energy process (e.g. dishwashing) which is initiated in the morning. Here “initiated” refers tosetting up for execution during a specified time interval. The energyrequired to execute the process is the integral of the load (power)shown on the vertical access over the time interval of the process.

In FIG. 10, element 1001 is the originally scheduled time for a service(e.g., washing the breakfast dishes). This is a relatively expensivetime, as utility rates are high and solar production is low. Element1002 is a better time—solar production exceeds the ability to sell tothe grid, so the marginal value of the power is zero. Performing theservice in zone 7 gets it done at no cost, but still in time for thefamily's arrival home after work.

During the configuration process, parameters can be established forvarious daily profiles and for the end-use technologies. The end-usetechnology profile specifies what can be controlled and how, aspreviously described. The daily profile describes the preferredset-point for each technology over the course of the day, such as thetemperature. For deferrable loads, the configuration specifies when theservice must be available. For example, the specification for the hotwater heater may require that hot water be available at 0730 for themorning wakeup and at 1800, while the dishwasher must have finishedrunning by 0730 or 1700. Given these parameters, according to theinvention the optimal time to execute the process can be determined.

This determination rests on the least cost dispatch calculation and,hence, is outside the capability of the HAC systems other than theinvention. The method of this variation of the invention is shown inFIG. 11. The least cost dispatch calculation determines the marginalvalue of electric power as a function of the time of day as describedpreviously. The management of deferrable loads begins with theconfiguration of deferrable loads (1101). In this step, the user of thesystem or the installer defines which loads (e.g. dishwashing,refrigeration) can be deferred and under what circumstances. Forexample, the rule can be established that there should be no pendingdishwashing at 0700 and 1700, meaning that the dishes must be cleanbefore breakfast and before dinner. The rule for refrigeration could bethat it must operate at least three hours out of every four. The rulefor freezers could be that it can be shut down for two hours at a time.The actual management process is initiated when a deferrable load isinitiated (i.e. scheduled for service) (step 1102). The least costdispatch model is rerun (step 1103). This, as described previously,divides the forecast period into zones (1 to n) and calculates themarginal value of electricity in each.

The calculation then determines which zones are candidates for thedeferrable service (1104). This is a two step process. First, there is asimple calculation to determine which zones occur before the deferrableload must be completed. Then, it is determined whether there issufficient power in that zone to complete the service. There are twoelements to this determination—the power determination and the energydetermination. Power is the instantaneous difference between thebaseline demand (i.e. without the deferred load) and the power availablein the zone without exceeding the capacity of the marginal supply(termed “available marginal supply capacity”). Exceeding the capacity ofthe marginal supply would increase the marginal cost of supply andpotentially the marginal value. The second part is to determine wherethere is sufficient energy to deliver the service. Energy is theintegral of power over time, so this determination involves integratingthe available marginal supply capacity over a contiguous interval whenthis capacity exceeds the demand of the deferrable load. This method isshown in FIG. 12.

The determination of whether a deferrable load can be serviced in a zoneis essentially a determination of whether there is an interval in thatzone during which there is sufficient marginal supply capacity to meetthe deferrable load. The actual load may vary by instant, but for thiscalculation it is sufficient to approximate it by a piecewise constantfunction comprised of short intervals. Five minutes is sufficient. Theprocess for determining whether there is sufficient marginal power in azone to supply a deferrable demand begins with dividing the zone intothese short intervals (step 1201). The available marginal supplycapacity (AMCS) in each interval is calculated (step 1202). The systemthen steps through the intervals in order to find a contiguous periodduring which the AMCS is, at all instances, greater than theapproximated load of the deferred services.

This determination begins by setting the hypothesis that there is enoughenergy to “not enough energy” and the length of the contiguous set ofintervals under test to 0 (steps 1202, 1203). Then, for the intervals inorder, the system tests whether the AMCS is greater than or equal to theload of the deferred service (step 1205). If not, the length of theinterval under test is set to zero (step 1206) and the search continuesthough the remainder of the zone. If there is sufficient capacity(AMCS>deferrable load), the length of the interval set is increased by 1(step 1207). At this point the method determines whether the entiredeferrable load requirement has been met (i.e. the length of theinterval set is greater than or equal to the duration of the deferrableload) (step 1208). If not, the next interval is tested. If so, then thehypothesis that there is sufficient energy is set to “enough energy”(step 1209) and the method ends with the determination that thedeferrable load can be scheduled for the zone under test.

If it is determined that there is more than one zone when the servicescan be performed, the system calculates when the services can beperformed at the lowest cost. This is done by looping through thecandidate zones (1105) and (1106). At the completion of the process, thedeferrable load is scheduled for execution. That is, the current on thedeferrable load's circuit is shut off until the start of the zonedetermined to be the lowest cost (step 1107).

If there is no zone which has sufficient energy available to perform thedeferred service without impacting the dispatch calculation, it isnecessary to accept that the service must be performed at a higher cost.In this case, the new cost is calculated by incrementing demand in eachzone before the scheduled time of delivery by an amount necessary tomeet the deferrable demand, and then repeating the least cost dispatchcalculation. The preferred zone to perform the service is the one wherethe marginal cost is lowest.

The third aspect of the optimization is the determination of when to buyor sell power from the grid. Sales to the grid can be made in threedifferent ways—(1) the meter can be run in reverse, essentially sellingpower back at the prevailing retail price, (2) when utilities declare anemergency, power can be sold under an established demand responseprogram, and (3) power can be sold in the wholesale power market.

Effective management of the buy/sell decision can be based on thearbitrage algorithm discussed below. This calculation builds on theleast cost dispatch algorithm, and should be executed after thedeferrable loads have been scheduled.

Variants of the invention include three capabilities for optimal energymanagement—(1) optimal (least-cost) dispatching of multiple supplies,(2) management of demand side resources, and (3) use of storage. Thissection addresses how storage can be deployed optimally. Storage cantake multiple forms, including batteries (including but not limited tolead acid and nickel metal hydride), large capacitors (sometimes calledsupercap), mechanical storage in the form of a flywheel, and compressedair. The invention is designed to work with any form of storage ormultiple forms of storage in a single installation. The specific form ofstorage is not critical, nor is storage technology an aspect of theinvention.

The value of storage technology is a manifest (1) storage providesemergency backup when supply from the grid is interrupted; (2) storagebuffers the difference between demand at an instant in the supply fromvariant sources like photovoltaics and wind, allowing them to be usedwhen there is no grid connection; (3) storage extends the period ofusefulness of technologies like solar and wind which show largevariation in production over the course of the day; (4) where the costof a supply varies over the course of the day (as in the case of time ofday rates) storage provides for shifting demand from time of high costto low cost; (5) storage can provide for the mitigation of “demandcharges” which are based on peak consumption, possibly to the extentnecessary to move to a lower cost contract; and (6) in sufficientquantity (as from multiple units (100's or 1000's) energy for and fromstorage can be traded on the wholesale market allowing for arbitraging.

For simplicity of notation, “buying” storage refers to putting energyinto storage from any source, and “selling” storage as discharging fromstorage to meet demand, sell to the grid, sell on the wholesale market,or transfer to another form or storage.

As the invention specifically addresses management of electricity, thelogical unit for measuring storage is Amp hours (Ah) at the voltage ofservice, which can be 120V, 220V split phase, 208 3 phase, or 240 2-wirefor foreign installations. The capacity and current storage ofmechanical technologies are not naturally measured in Amp hours, but inunits such as Newton meters for flywheels or liters at a pressure givenin kilopascals for compressed air. These, however, can be converted tothe equivalent Amp hours by a simple engineering calculation accountingfor the efficiency of the generator. The following pseudocode providesone example of the method of calculation:

-   -   Nt=number of technologies    -   Nz=number of “zones” of uniform value as shown in FIG. 10    -   Vk=the value of power in zone k. The value of power is the        marginal cost of power in a zone from the least-cost dispatch        calculation except in two cases—(1) where power is being sold,        at which point the value is the sales price, and (2) where there        is excess power from an alternative source than can neither be        sold or stored, in which case the value is zero.    -   SCi=Storage capacity of technology i    -   SSi,j=storage sold from technology i in time interval j    -   SBi,j=storage bought for technology i in time interval j    -   Cij=energy stored in technology i at end of time interval j    -   Cio=energy stored in technology I at start of planning period

Revenue in any time interval i is given by:

$\begin{matrix}{R = {\underset{j = 1}{\sum\limits^{n\; t}}{\underset{k = 1}{\sum\limits^{nz}}{\left( {{SSkj} - {SBkj}} \right){Vk}}}}} & \left( {{eq}.\mspace{14mu} 1} \right)\end{matrix}$

The objective is to maximize revenue as given above, subject to thestandard non-negativity constraint necessary to solution of a linearprogram:SSij≧0∀i,jSBij≧0∀i,j  (eq. 2)

Additionally, there are the obvious physical constraints that one cannot“buy” more storage than there is unused capacity or sell more storagethan there is currently stored. As defined, the storage at the start ofperiod 1 for technology i is Cio. The charge at the end of the period isgiven by:C _(i1) =C _(i0) +SB _(i1) −SS _(i1)C _(i2) =C _(i1) +SB _(i2) −SS _(i2) =C _(i0) +SB _(i1) −SS _(i1) +SB_(i2) −SS _(i2)C _(i3) =C _(i3) +SB _(i3) −SS _(i3) =C _(i0) +SB _(i1) −SS _(i1) +SB_(i2) −SS _(i2) +SB _(i3) −SS _(i3)

. . .

Generally,

$\begin{matrix}{{Cin} = {{Ci}_{0} + {\underset{j = 1}{\sum\limits^{n - 1}}\left( {{SBij} - {SSij}} \right)}}} & \left( {{eq}.\mspace{14mu} 3} \right)\end{matrix}$

The constraint on not buying more than the capacity allows is given by:SB _(in) ≦SC _(i) −C _(in−1) −∀i,nSB _(i1) ≦SC _(i) −C _(i0)  (eq. 4)

$\begin{matrix}{{SB}_{i\; n} \leq {{SC}_{i} - {\left( {C_{i0} + {\underset{j = 1}{\sum\limits^{n - 1}}\left( {{SBij} - {SSij}} \right)}} \right){\forall{n \geq 2}}}}} & \left( {{eq}.\mspace{14mu} 5} \right)\end{matrix}$

Equation 4 is in standard form for a linear program. Equation 5 is putin standard form simply by rearranging terms:

$\begin{matrix}{{{SB}_{i\; n} - {\underset{j = 1}{\sum\limits^{n - 1}}{SBij}} + {\underset{j = 1}{\sum\limits^{n - 1}}{SSij}}} \leq {{SC}_{i} - C_{i0}}} & \left( {{{eq}.\mspace{14mu} 5}a} \right)\end{matrix}$

The constraints on not selling more than is stored are stated asfollows:SS _(i,m) ≦C _(i,m−1) ∀i,mSS_(i,1)≦C_(io)  (eq. 6)

$\begin{matrix}{{SSim} \leq {\left( {C_{i0} + {\underset{j = 1}{\sum\limits^{m - 1}}\left( {{SBij} - {SSij}} \right)}} \right){\forall{n \geq 2}}}} & \left( {{eq}.\mspace{14mu} 7} \right)\end{matrix}$

As for the earlier constraints, equation 6 is in standard form andequation 7 is readily transformed:

$\begin{matrix}{{{SSin} - {\underset{j = 1}{\sum\limits^{n - 1}}{SBij}} + {\underset{j = 1}{\sum\limits^{n - 1}}{SSij}}} \leq C_{i0}} & \left( {{{eq}.\mspace{14mu} 7}a} \right)\end{matrix}$

Solution of this LP by standard means (e.g. the Simplex Algorithm) isnot difficult, but, as had been emphasized previously, this calculationmust be repeated frequently on a small processor. Hence, there may be anadvantage in simplifying the calculation to the maximum possible extent.These observations assist in simplifying the calculation:

Principle 1: Since the value of energy is constant in any period, if itmakes sense to buy storage, the system will buy the maximum amountpossible.

Principle 2: Similarly, if it makes sense to sell storage, the systemwill sell the maximum amount possible.

Principle 3: It will never make sense to both buy and sell in oneperiod.

Together, the first two observations transform the problem from ageneral linear programming problem into the special form of a binaryinteger program.

Let:

-   -   XSi,j=1 if capacity is sold from technology i in period j and 0        otherwise    -   XBi,j=1 if capacity is bought for technology i in period j and 0        otherwise

The objective function now becomes

$\begin{matrix}{{{Maximize}\mspace{14mu} R} = {\underset{j = 1}{\sum\limits^{n\; t}}{\underset{i = 1}{\sum\limits^{nz}}{\left( {{{XS}_{ij}{SS}_{ij}} - {{XB}_{ij}{SB}_{ij}}} \right)V_{i}}}}} & \left( {{eq}.\mspace{14mu} 8} \right)\end{matrix}$

Where SSij and SBij are constants calculated as follows:SS _(in) =C _(i,n−1)SB _(in) =SCi−C _(i,n−1)  (eq. 9)

Where Ci,n are still calculated as in equation 3.

The constraints are rewritten as follows:

$\begin{matrix}{{{SB}_{i\; n} - {\underset{j = 1}{\sum\limits^{n - 1}}{SBij}} + {\underset{j = 1}{\sum\limits^{n - 1}}{SSij}}} \leq {{SC}_{i} - {C_{i0}\mspace{14mu}{becomes}}}} & \left( {{{eq}.\mspace{14mu} 5}a} \right) \\{{{XBinSB}_{i\; n} - {\underset{j = 1}{\sum\limits^{n - 1}}{XBijSBij}} + {\underset{j = 1}{\sum\limits^{n - 1}}{XSijSSij}}} \leq {{SC}_{i} - C_{i0}}} & \left( {{{eq}.\mspace{11mu} 5}b} \right) \\{{{SSin} - {\underset{j = 1}{\sum\limits^{n - 1}}{SBij}} + {\underset{j = 1}{\sum\limits^{n - 1}}{SSij}}} \leq {C_{i0}\mspace{14mu}{becomes}}} & \left( {{{eq}.\mspace{14mu} 7}a} \right) \\{{{XBinSSin} - {\underset{j = 1}{\sum\limits^{n - 1}}{XBijSBij}} + {\underset{j = 1}{\sum\limits^{n - 1}}{XSijSSij}}} \leq C_{i0}} & \left( {{{eq}.\mspace{14mu} 7}b} \right)\end{matrix}$

This formulation is the simplest one. It assumes a perfect storage inwhich energy can be stored and retrieved without loss or any cost otherthan the cost of the energy. This is not a realistic case, but theexplanation is clearer without these additional complications and theformulation is precisely the same. There are two factors to consider.The first is that not all of the power purchased can be stored withperfect efficiency.

The simplest method to address this is to add an efficiency term to theobjective function, which provides for less revenue when power is sold.This term (eff) is less than 1 and is a linear approximation of averageenergy lost in a buy/sell (charge/discharge) cycle. The objectivefunction with an efficiency term is as follows:

$\begin{matrix}{{{Maximize}\mspace{14mu} R} = {\underset{j = 1}{\sum\limits^{n\; t}}{\underset{i = 1}{\sum\limits^{nz}}{\left( {{{eff} \times {XS}_{ij}{SS}_{ij}} - {{XB}_{ij}{SB}_{ij}}} \right)V_{i}}}}} & \left( {{eq}.\mspace{14mu} 10} \right)\end{matrix}$

The other factor to consider is that some forms of storage (notablybatteries) lose capacity with repeated cycles and are limited in thenumber of cycles they can execute. These can be addressed by adjustingthe objective function to include a cost of cycling as follows:

$\begin{matrix}{{{Maximize}\mspace{14mu}{\underset{j = 1}{\sum\limits^{n\; t}}{\underset{i = 1}{\sum\limits^{nz}}{{XS}_{ij}\left( {{eff} \times {SS}_{ij}V_{i}} \right)}}}} - {\underset{j = 1}{\sum\limits^{n\; t}}{\underset{i = 1}{\sum\limits^{nz}}{{XB}_{ij}\left( {{{SB}_{ij}V_{i}} + {CycleCost}} \right)}}}} & \left( {{Eq}.\mspace{14mu} 11} \right)\end{matrix}$

The constraints remain the same. CycleCost is the estimated cost ofexecuting a cycle. Cio in equation 3 is replaced with Cio′, which is afunction (determined, e.g., via experimentation and/or engineering datafor a specific device) of the starting capacity, the number of cycles,and the total amount of energy stored. This is stated as follows:

$\begin{matrix}{{Cio}^{\prime} = {F\left( {{Cio},{\underset{t = 0}{\sum\limits^{\infty}}{\underset{j = 0}{\sum\limits^{{nz}{(t)}}}({XSij})}},{\underset{t = 0}{\sum\limits^{\infty}}{\underset{j = 0}{\sum\limits^{{nz}{(t)}}}({SBij})}}} \right)}} & \left( {{Eq}.\mspace{14mu} 12} \right)\end{matrix}$

In equation 12 there are two summations over time from time=0 totime=infinity. These sums represent the history of the storage device.The sum of Xij represents the number of times the technology was used,as XSij=1 whenever power is added to the technology. The second doublesum (of SBij) equals the amount of energy added to the device over itslife since startup. Nz(t) is the number of zone used in a cycle. Thisfunction is characteristic of a specific storage technology. It shouldbe estimated from engineering principles and the design data for thespecific device.

At this point the problem has been formulated as a relatively simplebinary integer program with linear constraints. For the most common casewhere there is a single storage medium (e.g. batteries) and theforecasting period is limited to ten zones (1 to 1.5 days under mostutility rate schedules), the problems is then limited to 20 zero/onevariables (10 sell options and 10 buy options). Assuming that theoptimum solution would not likely involve selling in the 3 zones withthe lowest rates nor buying in the zones with the three highest rates,the problem size is reduced to 7 buy options and 7 sell options. Thus,in six of the 10 periods, there are only two options (do nothing andeither buy or sell depending on whether it is a high value period or alow value period), while in the other four period there are, in theory,four options do nothing, buy only, sell only, and buy and sell. The lastof these makes no sense, of course, so ¼ of the options need notevaluated, leaving only three. Thus, the total number of combinations isgiven byNumber of combinations=2⁶×3⁴=5184.

As the evaluation of an option involves only a few simple additions, theoptions can be quickly evaluated through simple enumeration. This case,while special, is in fact the most common as there are very few if anycurrent installations with more than one form of storage.

For larger cases it may be necessary to solve the problem by thestandard means of solving binary integer programming problems, asaddressed in the section on least cost dispatch.

Referring again to FIG. 3, step 311 will now be explained in more detail(estimating the daily service profile). The daily service profile is anestimate of load over the course of the forecasting period. Theforecasting period at a minimum should span the next 24 hours, but 48hours may be better. The only barrier to the longer period is theprocessor time required to perform the longer forecast without impactingthe basic safety monitoring function of the controller's processor. Thesize of the problem that must be solved at any installation for anyperiod is determined by the number of load zones reflecting changes inthe grid rate schedule or the relative rank of costs of the grid andalternative sources. More zones imply a larger optimization problem andexponentially longer solution time, potentially reducing the forecastperiod from 48 hours to the acceptable 24 hours.

In preparing the daily service profile, demand (measured in kW) can beestimated at 15 minute intervals for the forecast period. There are twopreferred methods for doing this. The first method is based on pastusage patterns. This is shown in FIG. 13. The process begins with thespecification of categories of patterns (1301). In a typical home orbusiness, there are distinct differences between different kinds ofdays, such as weekdays or weekends, workdays or non-work days, vacationdays, holidays, or other. In addition, patterns will be defined forsunny days, cloudy days, partly cloudy days, and rainy days. Usingengineering principles, (e.g. a building energy model like DOE-2) anestimate can be made of the load for 15 minute intervals for the next 24hours (step 1302). While this estimate should be as accurate as canreadily be obtained, it is not critical that it be highly accurate, asthe remainder of the process is directed at correcting this error.

The next step is to select a pattern for use for the next 24 hours (step1303). If the day is a weekday and sunny, for example, a sunny weekdaypattern should be elected. Again, however, the consequences of choosinga bad pattern at this point are not serious. At this point the routinere-estimation begins. This is shown by the loop (step 1308) whichexecutes every 15 minutes or more frequently if new data are receivedfrom the network indicating a change in ambient conditions, utilityrates, or other factors or there is a substantial change in the load atthe house.

Every cycle, actual load for the past four hours is compared to the loadfrom each available pattern. A correlation coefficient (r-squared) iscalculated, (1304) and the best match is identified (1305). This patternis then scaled up or down linearly to reflect the absolute level ofenergy use (1306) as described below. The final step is to update thepattern to reflect actual energy use (1307). A simple method foraccomplishing this is described below. An alternative method is to use aBayesian approximation.

The objective of this final step is to improve the fidelity of thepatterns after the initial crude estimate, to accommodate changes in thepremises, to incorporate longer term patterns in energy use (such asfrom climate or the degradation of HVAC equipment). Short-term changesas in the case of weather are integrated by re-estimation every 15minutes or more frequently in response to changing conditions.Historically, one of the best predictions of a day's weather is toassume that it will be like yesterday, and the best prediction of theupcoming hour is the past hour. Obviously, however, weather does change.When forecast information is available, this can be transmitted from thecontrol center (101) to the facility in the form of direction to use aspecific pattern. In this way the forecast can accommodate predictionsfor rain, snow, clearing, or other weather patterns. One method fordoing this is described below.

Define Np Number of patterns (e.g. weekday, weekend, vacation) T Timeperiod in 15 minute intervals t = (−16 . . . −1) for the four hoursprior to the current time t = 0 for the current time t = (1 . . . 96)for the next 24 hours Lij Load (kW) at time j using pattern i ALj Actualload (kW) at time j, j = (−16 . . . −1) (prior four hours) PLj Predictedload (kW) at time j, j = 1.96 (next 24 hours) SF Scale factor, which isthe ratio of the energy actually used in the last four hours over theenergy that would have been used had the selected pattern actuallypertained

Step 1: Identify the most accurate pattern. Calculate r² for ALj vs. Lijfor all patterns i, for the past four hours (j=−16 . . . −1). r² is thestandard goodness of fit measure, where r is givenby=[Cov(AL,Li)]/[StdDev(AL)×StdDev(Li)]. Use pattern i which has thehighest r².

Step 2: Scale the selected pattern to reflect actual use. Use pattern iwhich has the highest r². Estimate demand for the next 24 hours byscaling the selected pattern by the ratio of the actual absolute use ofenergy over the past four hours vs. the energy use as expressed in theselected pattern.

${{SF} = {\underset{j = {- 16}}{\sum\limits^{- 1}}{{ALj}/{\underset{j = {- 16}}{\sum\limits^{- 1}}{Lij}}}}}\quad$PLj=SF×Lij for j=(1 . . . 96)

Use this PLj as the forecasted for the next 24 hours.

Step 3: Update the Pattern. Adjust the pattern to reflect the differencebetween measured and projected for the last hour and the scale factorused for the forecast.

Lij=0.5*(Lij+ALj) for j=(−16 . . . −1)—past is average of actual andestimated

Lij=Lij*((SF+1)/2) for j=(1 . . . 96)—future is adjusted by having thescale factor estimate demand for the next 24 hours by scaling theselected pattern by the ratio of the actual absolute use of energy overthe past four hours vs. the energy use as expressed in the selectedpattern.

Any of the steps or modules described above may be provided in softwareand stored as computer-executable instructions on one or morecomputer-readable media. Numerals used in the appended claims areprovided for clarity only and should not be interpreted to limit theorder of any steps or elements recited in the claims.

1. A method for allocating electrical energy at a location where the electrical energy is consumed, comprising the computer-implemented steps of: (1) determining a marginal cost for each of a plurality of energy sources available at the location, at least one of which is a non-grid source of electricity; (2) determining a capacity of electrical energy available from each non-grid energy source; (3) determining a demand for electrical energy at the location; (4) dynamically allocating, in order of lowest marginal cost to highest marginal cost, electrical energy capacity from each of the plurality of energy sources to meet the demand; (5) reducing demand at the location by automatically deferring electrical consumption for a device for which consumption can be deferred from a higher-cost time period to a lower-cost time period, including the computer-implemented step of issuing a command to the device to cause the deferral to occur, and further including determining projected marginal costs in each of a plurality of future time frames and deferring electrical consumption for the device to one of the plurality of future time frames while conforming to an operational constraint for the device, the operational constraint for the device comprising a maximum time duration for which the device can be swithched off.
 2. The method of claim 1, wherein step (4) comprises the step of allocating electrical energy from at least two of the plurality of energy sources concurrently.
 3. The method of claim 1, wherein one of the plurality of energy sources comprises a grid-based source of electrical energy having a time-varying marginal cost.
 4. The method of claim 3, further comprising the step of receiving at the location via electronic means the time-varying marginal cost of the grid-based source.
 5. The method of claim 1, wherein one of the plurality of energy sources comprises a photovoltaic source having a time-varying capacity, and wherein step (2) comprises the step of determining the capacity of electrical energy available from the photovoltaic source.
 6. The method of claim 1, wherein one of the plurality of energy sources comprises a microhydro-based source having a time-varying capacity, and wherein step (2) comprises the step of determining the capacity of electrical energy available from the microhydro-based source.
 7. The method of claim 1, one of the plurality of energy sources comprises a gas turbine-based energy source.
 8. The method of claim 1, wherein one of the plurality of energy sources comprises a wind-based energy source having a time-varying capacity, and wherein step (2) comprises the step of determining the capacity of electrical energy available from the wind-based energy source.
 9. The method of claim 1, wherein one of the plurality of energy sources comprises a fuel cell-based energy source.
 10. The method of claim 1, wherein one of the plurality of energy sources comprises a backup generator.
 11. The method of claim 1, wherein one of the plurality of energy sources comprises a battery.
 12. The method of claim 1, wherein step (4) includes treating at least one of the plurality of sources as having a capacity exceeding demand.
 13. The method of claim 1, further comprising the step of determining whether electrical energy in excess of the demand can be economically sold back to the power grid and, if so, allocating such excess electrical energy to the power grid.
 14. The method of claim 1, wherein step (5) comprises the step of determining that a solar-based energy source will have a higher capacity in one of the future time frames.
 15. The method of claim 1, wherein an operational constraint for a second device comprises an end time during which the second device must have completed its operating cycle.
 16. The method of claim 1, further comprising the step of projecting demand in each of a plurality of future periods based on historical data and using the projected demand in making deferral determinations.
 17. The method of claim 1, further comprising the step of projecting demand in each of a plurality of future time periods based on weather forecast data and using the projected demand in making deferral determinations.
 18. The method of claim 1, wherein step (4) comprises the step of allocating non-grid energy sources having a lower marginal cost first and, only if non-grid energy sources cannot satisfy the demand, thereafter allocating a grid-based energy source.
 19. The method of claim 1, wherein at least one of the plurality of energy sources has a non-constant marginal cost that varies based on the capacity drawn by a single location from that energy source.
 20. The method of claim 17, wherein the at least one energy source comprises a generator.
 21. The method of claim 1, wherein step (1) comprises the step of approximating a cost production curve for the at least one energy source using piecewise linear segments.
 22. The method of claim 1, wherein step (4) comprises the step of dynamically allocating electrical energy from a battery.
 23. The method of claim 1, further comprising the step of determining, on the basis of step (1), whether to store electrical energy in a battery for later use and, if such determination is made, causing such storage to occur.
 24. The method of claim 1, further comprising the step of determining, on the basis of a time-varying cost of grid-based electrical energy, whether it is cost-effective to sell electrical energy back to a grid-based source and, if so, automatically initiating such sale.
 25. The method of claim 24, further comprising the step of selling electrical energy from a battery to the grid-based source.
 26. The method of claim 1, further comprising the step of projecting future demand in future time periods.
 27. The method of claim 1, wherein step (2) comprises the step of projecting capacity in each of a plurality of future time periods based on weather forecast data.
 28. The method of claim 1, further comprising the step of repeating steps (1) through (4) continuously in a computer-controlled loop.
 29. A computer-readable medium comprising computer-readable instructions that, when executed by a computer, perform the steps of: (1) determining a marginal cost for each of a plurality of energy sources available at a location, at least one of which is a non-grid source of electricity; (2) determining a capacity of electrical energy available from each non-grid energy source; (3) determining a demand for electrical energy at the location; (4) dynamically allocating, in order of lowest marginal cost to highest marginal cost, electrical energy capacity from each of the plurality of energy sources to meet the demand; and (5) reducing demand at the location by automatically deferring electrical consumption for a device for which consumption can be deferred from a higher-cost time period to a lower-cost time period, including the computer-implemented step of issuing a command to the device to cause the deferral to occur, and further including determining projected marginal costs in each of a plurality of future time frames and deferring electrical consumption for the device to one of the plurality of future time frames while conforming to an operational constraint for the device, the operational constraint for the device comprising a maximum time duration for which the device can be swithched off.
 30. The computer readable medium of claim 29 wherein step (4) comprises the step of allocating electrical energy from at least two of the plurality of energy sources concurrently.
 31. The computer-readable medium of claim 29, wherein one of the plurality of energy sources comprises a grid-based source of electrical energy having a time-varying marginal cost.
 32. The computer-readable medium of claim 31, further comprising the step of receiving at the location via electronic means the time-varying marginal cost of the grid-based source.
 33. The computer-readable medium of claim 29, wherein one of the plurality of energy sources comprises a photovoltaic source having a time-varying capacity, and wherein step (2) comprises the step of determining the capacity of electrical energy available from the photovoltaic source.
 34. The computer-readable medium of claim 29, further comprising the step of determining whether electrical energy in excess of the demand can be economically sold back to the power grid and, if so, allocating such excess electrical energy to the power grid.
 35. The computer-readable medium of claim 29, further comprising the step of projecting demand in each of a plurality of future periods based on historical data and using the projected demand in making deferral determinations.
 36. The computer-readable medium of claim 29, further comprising the step of projecting demand in each of a plurality of future time periods based on weather forecast data and using the projected demand in making deferral determinations.
 37. The computer-readable medium of claim 28, further comprising the step of determining, on the basis of step (1), whether to store electrical energy in a battery for later use and, if such determination is made, causing such storage to occur.
 38. The computer-readable medium claim 29, further comprising the step of determining, on the basis of a time-varying cost of grid-based electrical energy, whether it is cost-effective to sell electrical energy back to the grid-based source and, if so, automatically initiating such sale.
 39. An apparatus, comprising: a computer including a memory, the memory including computer-readable instructions that, when executed by the computer, perform the steps of (1) determining a marginal cost for each of a plurality of energy sources available at a location, at least one of which is a non-grid source of electricity, (2) determining a capacity of electrical energy available from each non-grid energy source, (3) determining a demand for electrical energy at the location, (4) dynamically allocating, in order of lowest marginal cost to highest marginal cost, electrical energy capacity from each of the plurality of energy sources to meet the demand, and (5) reducing demand at the location by automatically deferring electrical consumption for a device for which consumption can be deferred from a higher-cost time period to a lower-cost time period, including the computer-implemented step of issuing a command to the device to cause the deferral to occur, and further including determining projected marginal costs in each of a plurality of future time frames and deferring electrical consumption for the device to one of the plurality of future time frames while conforming to an operational constraint for the device, the operational constraint for the device comprising a maximum time duration for which the device can be switched off. 